home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2006 October / wn148cd2.iso / Windows / Travailler / QuickZip / quickzip_460013.exe / {app} / Scripts / C_Relative.akp < prev    next >
Text File  |  2003-05-11  |  2KB  |  79 lines

  1. //Compare and update the files in <Dir1> and <Dir2>.
  2. //Backup overwrited file to <BackupChanges>.
  3. const Directory2Backup = 'c:\FoldertoBackup\';
  4.       ZipDirectory = 'c:\BackupTo\';
  5. var
  6.     Path1,ZipPath : String;
  7. var aForm : TForm;
  8.     Button1,Button2,ConfirmButton : TButton;
  9.     Edit1,Edit2 : TEdit;
  10.     Label1,Label2 : TLabel;
  11. procedure Button1Click(sender: TObject);
  12. var k : string;
  13. begin
  14.    k := AskDirDialog(Edit1.text);
  15.    if k <> '' then
  16.      Edit1.text := k;
  17. end;
  18. procedure Button2Click(sender: TObject);
  19. var k : string;
  20. begin
  21.    k := AskDirDialog(Edit2.text);
  22.    if k <> '' then
  23.      Edit2.text := k;
  24. end;
  25.  
  26. procedure Continueclick(sender: TObject);
  27. begin
  28.   aForm.Close;
  29. end;
  30. function AskDirectory : boolean;
  31. begin
  32.     Result := False;
  33.     aForm := New_Form(100,100,500,200,'Please Configure and press Continue');
  34.     Label1 := new_Label(aForm,10,10,'Directory to Backup : ');
  35.     Edit1 := new_Edit(aForm,120,10,200,20,Directory2Backup);
  36.     Button1 := New_Button(aForm, 350, 10, 100, 20, 'Browse');
  37.     Button1.OnClick := @Button1Click;
  38.     Label2 := new_Label(aForm,10,40,'Zip Directory : ');
  39.     Edit2 := new_Edit(aForm,120,40,200,20,ZipDirectory);
  40.     Button2 := New_Button(aForm, 350, 40, 100, 20, 'Browse');
  41.     Button2.OnClick := @Button2Click;
  42.     ConfirmButton := New_Button(aForm, 350, 130, 100, 30, 'Continue');
  43.     ConfirmButton.Default := True;
  44.     ConfirmButton.ModalResult := mrOK;
  45.     ConfirmButton.OnClick := @Continueclick;
  46.     show_Form(aForm);
  47.     if aForm.modalResult = Mrok then
  48.     begin
  49.     Path1 := AppendSlash(Edit1.text);
  50.     ZipPath := AppendSlash(Edit2.text);
  51.     Result := true;
  52.     end;
  53. end;
  54.  
  55. procedure ReWritepath;
  56. var k : string;
  57.     ts : TStringlist;
  58. begin
  59.     k := AskFilenameDialog('c:\Relative.akp','Akp Script|*.akp');
  60.     if k <> '' then
  61.      begin
  62.          ts := TStringlist.create;
  63.          if fileexists(programpath+'Scripts\Relative.akp') then
  64.          ts.loadfromfile(programpath+'Scripts\Relative.akp');
  65.          ts.strings[2] := 'const Directory2Backup='''+path1+''';';
  66.          ts.strings[3] := '         ZipDirectory='''+ZipPath+''';';
  67.          MakeDir(ZipPath);
  68.          ts.savetofile(k);
  69.          ts.free;
  70.      end;
  71.  
  72. end;
  73.  
  74. begin
  75.   if AskDirectory then
  76.    ReWritepath;
  77.   Writeln('Completed!');
  78. end.
  79.